<?php

function DieParamsError($addition = '') {
    echo 'input params error . ' . $addition;
    die(400);
}

function DieMysqlError($addition = '') {
    echo 'database operation error . ' . $addition;
    die(500);
}

function DieLoginError() {
    echo '403 forbidden';
    die(403);
}

function Success($message = '', $data = null) {
    return json([
        'code'      =>  1,
        'message'   =>  '',
        'data'      =>  $data,
    ]);
}

function Error($message = '', $data = null) {
    return json([
        'code'      =>  0,
        'message'   =>  $message,
        'data'      =>  $data,
    ]);
}

function SuccessImageUpload($data) {
    return json([
        'errno'     =>  0,
        'data'      => $data,
    ]);
}

function ErrorImageUpload($message) {
    return json([
        'errno'     => 1,
        'message'   => $message,
    ]);
}

